package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Mobile   string `gorm:"type:varchar(30);comment:手机号"`
	Qq       string `gorm:"type:varchar(30);comment:qq号"`
	Wx       string `gorm:"type:varchar(32);comment:微信号"`
	Email    string `gorm:"type:varchar(30);comment:邮箱号"`
	Password string `gorm:"type:varchar(32);comment:密码"`
	SendSms  string `gorm:"type:varchar(30);comment:短信验证码"`
}

func (u *User) FindByUser(db *gorm.DB, mobile string) error {
	return db.Where("mobile=?", mobile).Find(u).Error
}

func (u *User) FindByUserAccount(db *gorm.DB, account string) error {
	return db.Where("qq=? or wx=? or email=?", account, account, account).Find(u).Error
}
